<template>
  <div v-if="$store.getters.user.userRole=='超级管理员'">
      <!-- <el-tree style="min-height:800px;width:180px;background-color:#EFF2F7"
      node-key="id" :default-expanded-keys="[1,2]" :data="datas" :props="defaultProps" @node-click="handleNodeClick"></el-tree> -->
      <dd class="Mytree">
        <dl style="font-weight: bold;">开发区各村镇列表</dl>
        <dl class="treeNode" v-for="v in datas" @click="handleNodeClick(v.id)" :key="v.id">{{v.label}}</dl>
      </dd>
  </div>
</template>

<script>
import * as api from "@/api/orgManage";
export default {
  data(){
    return{
     datas:[

     ],
     defaultProps: {
          children: 'children',
          label: 'label'
        }
    }
  },
  methods: {
    handleNodeClick(data) {
      this.$emit('GetNodeValue',data)
    }
  },
  mounted(){
    api.getOrgCode().then(res => {
        let Grid = res.data.netGrid
        for(let i=0;i<Grid.length;i++){
          var obj = {
            id:Grid[i].netGridID,
            label:Grid[i].netGridName
          }
          this.datas.push(obj)
        }
    });
  }
};
</script>

<style>
.is-current {
  color: #1d8ce0;
  font-weight: 1200;
}
.Mytree{
  border: 1px solid #E5E9F2;
  margin-right: 5%;
  text-align: center;
  margin-top: 52px;
  border-radius: 2px;
  background: #EFF2F7;
  margin-left: 0;
}
.treeNode{
  cursor: pointer;
  padding-top:6px;
  padding-bottom:0px;
  color: #1D8CE0;
}
.treeNode:hover{
  color:purple;
  font-weight: bold;
}
</style>

